home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / hAWK project / AWK Source / hAWK_time.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-22  |  1.2 KB  |  33 lines  |  [TEXT/KEEN]

  1. /* hAWK_time.c : the time() function */
  2. /* Copyright © 1986, 1988, 1989 1991 the Free Software Foundation, Inc.
  3.  *         This file is part of GAWK, the GNU implementation of the
  4.  * AWK Progamming Language, modified for the Macintosh (also called hAWK).
  5.  *         GAWK is free software; you can redistribute or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 1, or any later version.
  8.  *         GAWK is distributed in the hope that it will be useful,
  9.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11.  * GNU General Public License for more details.
  12.  *         You should have received a copy of the GNU General Public License
  13.  * along with GAWK; see the file "COPYING hAWK". If not, write to
  14.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  15.  * Written for THINK C 4 on the Macintosh by Ken Earle (Dynabyte) Aug 1991.
  16.  */
  17. #include "AWK.H"
  18.  
  19. NODE *do_time(NODE *tree);
  20.  
  21. NODE *do_time(NODE *tree)
  22.     {
  23.     time_t        now;
  24.     struct tm    *date;
  25.     char        s[80];
  26.     short         i;
  27.     
  28.     now = time(NULL);
  29.     date = localtime(&now);
  30.     i = strftime(s,80, "%A, %B %d, %Y %I:%M:%S %p", date);
  31.     return(tmp_string(s, i));
  32.     }
  33.